Skip to main content

MasterChef

The MasterChef gives out a constant number of ULX per block, for liquidity providers that stake LP tokens within contract.

New ERC20s or pools are added/updated by the owner of the contract with allocation points that determines the number of ULX rewarded to each pool.

MasterChef is the only contract with minting rights for the ULX token.

The full contract can be found here.

Functions​

poolLength​

function poolLength(
) external view returns (uint256)

Polls and returns the total number of pools added.

add​

function add(
uint256 _allocPoint,
IERC20 _lpToken
) public onlyOwner

Adds a new LP/Token to be staked, and can only be called by the owner.

Adding duplicate pools can cause problems with the rewards.

Parameters​

NameTypeDescription
_allocPointuint256number of allocation points assigned to pool
_lpTokenIERC20address of ERC20 token that will be staked

set​

function set(
uint256 _pid,
uint256 _allocPoint
) public onlyOwner

Updates the allocation points assigned to an existing pool, and can only be called by the owner.

Parameters​

NameTypeDescription
_piduint256id for individual pool
_allocPointuint256number of allocation points assigned to pool

getMultiplier​

function getMultiplier(
uint256 _from,
uint256 _to
) public view returns (uint256)

Polls and returns reward multiplier over a given _from to _to block.

Parameters​

NameTypeDescription
_fromuint256start block number
_touint256end block number

pendingwULX​

function pendingwULX(
uint256 _pid,
address _user
) external view returns (uint256)

Polls and returns pending ULXs to be claimed for a given pool and user.

Parameters​

NameTypeDescription
_piduint256id for individual pool
_useraddressaddress for user

massUpdatePools​

function massUpdatePools(
) public

Updates reward variables for all pools.

updatePool​

function updatePool(
uint256 _pid
) public

Update reward variables for a given pool to be kept up-to-date.

Is called on all withdraws, and deposits. So will only be called by itself individually for pools that aren't as active to keep them up-to-date when updating allocation points.

Parameters​

NameTypeDescription
_piduint256id for individual pool

deposit​

function deposit(
uint256 _pid,
uint256 _amount
) public

Deposit LP tokens to MasterChef to start accruing ULX rewards.

Parameters​

NameTypeDescription
_piduint256id for individual pool
_amountuint256amount of tokens to deposit

withdraw​

function withdraw(
uint256 _pid,
uint256 _amount
) public

Withdraw LP tokens from MasterChef.

Parameters​

NameTypeDescription
_piduint256id for individual pool
_amountuint256amount of tokens to withdraw

emergencyWithdraw​

function emergencyWithdraw(
uint256 _pid
) public

Withdraw LP tokens from MasterChef without receiving ULX rewards. To be only used for emergencies or problems with harvesting rewards.

Parameters​

NameTypeDescription
_piduint256id for individual pool

harvestAll​

function harvestAll() external

Batch harvest all rewards from all staked pools